<template>
  <div>
    <el-card>
      <el-form ref="elForm" :model="formData" :rules="rules" size="mini" label-width="200px">
        <el-row :gutter="6">
          <el-col :span="9">
            <el-form-item label="日期范围" prop="field113">
              <el-date-picker type="daterange" v-model="formData.field113" format="yyyy-MM-dd"
                value-format="yyyy-MM-dd" :style="{width: '100%'}" start-placeholder="开始日期"
                end-placeholder="结束日期" range-separator="至" clearable></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12" style="display: flex;">
            <el-form-item label="发布后不能马上预约" label-width="200px" >
              <el-select v-model="value" placeholder="请选择">
                <el-option
                  v-for="item in options"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                  :disabled="item.disabled">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item  label-width="0" style="margin-left: 20px;">
              <el-time-picker
                :picker-options="{
                selectableRange: '18:30:00 - 20:30:00'
                }"
                placeholder="预约开始时间">
              </el-time-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="6">
        <el-col :span="9">
          <el-form-item label="上午时间范围" prop="field112" label-width="200px">
            <el-time-picker style="width: 100%;" is-range format="HH:mm:ss" value-format="HH:mm:ss"
                            start-placeholder="开始时间" end-placeholder="结束时间" range-separator="至"
                            clearable></el-time-picker>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="下午时间范围" prop="field112" label-width="200px">
            <el-time-picker style="width: 100%;" is-range format="HH:mm:ss" value-format="HH:mm:ss"
                            start-placeholder="开始时间" end-placeholder="结束时间" range-separator="至"
                            clearable></el-time-picker>
          </el-form-item>
        </el-col>
        </el-row>
        <el-row :gutter="6">
        <el-col :span="8">
          <el-form-item label="时间粒度" prop="field111">
            <el-input v-model="formData.field111" placeholder="30" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="7">
          <el-form-item label="粒度单位" prop="field114">
            <el-radio-group v-model="formData.field114" size="medium">
              <el-radio v-for="(item, index) in field114Options" :key="index" :label="item.value"
                        :disabled="item.disabled">{{item.label}}</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
        <el-col :span="9">
          <el-form-item label="粒度预约人数上限" label-width="200px">
            <el-input-number v-model="numLimit"   :min="1" :max="100" label="描述文字"></el-input-number>
          </el-form-item>
        </el-col>
        </el-row>

        <el-row :gutter="6">
        <el-col :span="24" style="display: flex;">
          <el-form-item label="提前提醒已预约的家长" label-width="200px" >
            <el-select v-model="value" placeholder="请选择">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
                :disabled="item.disabled">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item  label-width="0" style="margin-left: 20px;">
            <el-time-picker
              :picker-options="{
              selectableRange: '18:30:00 - 20:30:00'
              }"
              placeholder="提前多长时间提醒">
            </el-time-picker>
          </el-form-item>
        </el-col>
        </el-row>
          <el-row :gutter="6">
        <el-col :span="24">
          <el-form-item label-width="200px">
            <el-input  type="textarea" placeholder="请输入提前提醒内容,不输入则使用系统默认"
                       :autosize="{minRows: 4, maxRows: 4}" :style="{width: '100%'}"></el-input>
          </el-form-item>
        </el-col>
          </el-row>
        <el-col :span="24">
          <el-form-item label="预约成功发送通知给家长" label-width="200px">
            <el-select v-model="value" placeholder="请选择">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
                :disabled="item.disabled">
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-row :gutter="6">
        <el-col :span="24">
          <el-form-item label-width="200px">
            <el-input  type="textarea" placeholder="请输入预约成功发送给家长的内容,不输入则使用系统默认"
                       :autosize="{minRows: 4, maxRows: 4}" :style="{width: '100%'}"></el-input>
          </el-form-item>
        </el-col>
        </el-row>
        <el-row :gutter="6">
        <el-col :span="24">
          <el-form-item label="备注" label-width="200px">
            <el-input  type="textarea" placeholder="请输入备注,不输入则使用系统默认"
                       :autosize="{minRows: 4, maxRows: 4}" :style="{width: '100%'}"></el-input>
          </el-form-item>
        </el-col>
        </el-row>
          <el-row :gutter="6">
        <el-col :span="24">
          <el-form-item size="large" style="display: flex;justify-content: center">
            <el-button type="primary" @click="submitForm">提交</el-button>
            <el-button @click="resetForm">重置</el-button>
          </el-form-item>
        </el-col>
          </el-row>
      </el-form>
    </el-card>
  </div>
</template>
<script>
export default {
  components: {},
  props: [],
  data() {
    return {
      formData: {
        field113: null,
        field112: ["09:00:00", "17:00:00"],
        field111: undefined,
        field114: 2,
      },
      value: '是',
      timeValue: '',
      numLimit: 3,
      value1: new Date(2016, 9, 10, 18, 40),
      options: [{
        value: '1',
        label: '是'
      }, {
        value: '0',
        label: '否'
      }],
      rules: {
        field113: [{
          required: true,
          message: '日期范围不能为空',
          trigger: 'change'
        }],
        field112: [{
          required: true,
          type: 'array',
          message: '请至少选择一个field112',
          trigger: 'change'
        }],
        field111: [{
          required: true,
          message: '30',
          trigger: 'blur'
        }],
        field114: [{
          required: true,
          message: '粒度单位不能为空',
          trigger: 'change'
        }],
      },
      field114Options: [{
        "label": "时",
        "value": 1
      }, {
        "label": "分",
        "value": 2
      }],
    }
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    submitForm() {
      this.$refs['elForm'].validate(valid => {
        if (!valid) return
        // TODO 提交表单
      })
    },
    resetForm() {
      this.$refs['elForm'].resetFields()
    },
  }
}

</script>
<style>
</style>
